home *** CD-ROM | disk | FTP | other *** search
- Path: slip129-37-240-94.nc.us.ibm.net!user
- From: RobTerrell@vmedia.com (Rob Terrell)
- Newsgroups: comp.lang.c++
- Subject: Accessing base methods?
- Date: Fri, 15 Mar 1996 12:32:28 -0500
- Organization: Fringe Multimedia, Inc.
- Message-ID: <RobTerrell-1503961232280001@slip129-37-240-94.nc.us.ibm.net>
- NNTP-Posting-Host: slip129-37-240-94.nc.us.ibm.net
-
-
- I'm just coming back to C++ after a 6-year absence...and I'm trying to
- figure out how to access the base methods of a derived class.
-
- Take this class:
-
-
- class base {
-
- virtual void Move();
- }
-
- class derived : public base {
-
- void Move();
- }
-
-
- Okay, so when I'm in the method....
-
-
- void derived::Move()
- {
-
- // do stuff here
-
- // Now I want to call the base class' Move
-
- }
-
- How do I do this? I've tried this...
-
-
- (base*)this->Move();
-
-
- and crashed spectacularly. I've also tried...
-
-
- base *p;
- p = &derived_obj;
-
- p->Move();
-
- With the same explosive results. Can anyone point me in the right direction?
-
-
- Thanks,
-
-
-
- Rob
-